<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pe="http://primefaces.org/ui/extensions">

<ui:composition template="/templates/template.xhtml">

	<ui:define name="content">
		<h:form id="formPrincipal">
			<p:growl id="mensagens" life="#{msg.time_stick}" />

			<p:panel id="painel" >
				<f:facet name="header">
					<div align="left"><h:outputText value="Alertas do dia." styleClass="tituloPainelInterno"/></div>
				</f:facet>
				
				<p:dataTable styleClass="tabelaCompleta" value="#{notificacaoFaces.listaNotificacoes}" 
					var="item" 	emptyMessage="Não há alertas." 
					rowStyleClass="#{empty rowIx or rowIx mod 2 ne 0 ? 'even-row' : 'odd-row'}" rowIndexVar="rowIx"
					>
				
					<p:column headerText="Data" width="15%">
						<h:outputText value="#{item.dataNotificacao}" >
							<f:convertDateTime pattern="#{msg.masc_dataComHora}" locale="#{msg.local_locale}" timeZone="#{msg.local_timezone}"/>
						</h:outputText>
					</p:column>
					
					<p:column headerText="Descrição">
						<h:outputText value="#{item.textoNotificacao}" />
					</p:column>
					
					<p:column headerText="Opções" width="10%">
							<p:commandLink styleClass="ui-icon ui-icon-pencil" 
									actionListener="#{notificacaoFaces.enviarEmail(item)}"
									update=":formPrincipal:mensagens :formPrincipal:painel"
									style="float:left;"
									id="enviarEmail"
							/>
							
							<p:tooltip for="enviarEmail">
								<h:outputText value="Enviar Email" /> <br />
								<h:outputText value="Avisos enviados #{item.quantidadeAvisos}" />
							</p:tooltip>
					</p:column>
					
				</p:dataTable>
			</p:panel>
			
		</h:form>
	</ui:define>
</ui:composition>
</html>